﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using UserSystemApi.Entity;

namespace UserSystemApi.Core
{
    public interface IRepository<TEntity> where TEntity : BaseEntity
    {
        Task<TEntity> GetEntityByIdAsync(int id);
        Task<bool> DeleteAsync(int id);
        Task<TEntity> DeleteAsync(TEntity entity);
        Task<TEntity> GetAsync(Expression<Func<TEntity, bool>> predicate);
        Task<List<TEntity>> GetListAsync();
        Task<List<TEntity>> GetListAsync(Expression<Func<TEntity, bool>> predicate);
        Task<List<TEntity>> GetListAsync(Expression<Func<TEntity, bool>> predicate, string sort, int pageIndex, int pageSize);
        Task<TEntity> InsertAsync(TEntity entity);
        Task<TEntity> UpdateAsync(TEntity entity);
        Task<int> UpdateResultIdAsync(TEntity entity);
        Task<int> InsertResultIdAsync(TEntity entity);
    }
}
